package com.bwf.service;

import com.bwf.pojo.Account;
import com.bwf.pojo.CreditAccount;
import com.bwf.pojo.SavingAccount;

/**
 * @version v1.0
 * @description:
 * @author: admin
 * @date: 2022/12/19 13:46
 * @copyright: 博为峰
 */
public class Bank {
    public Account[] accounts = new Account[3];

    public Bank() {
        accounts[0] = new SavingAccount("110", "123", 999);
        accounts[1] = new SavingAccount("119", "123", 1999);
        accounts[2] = new CreditAccount("122", "123", 666);
    }

    public Account verify(String cardNo, String password) {
        for (int i = 0; i < accounts.length; i++) {
            if (accounts[i].getCardNo().equals(cardNo) && accounts[i].getPasswd().equals(password)) {
                return accounts[i];
            }
        }
        return null;
    }
}
